package com.pwc.conversionTool.soapUtil.thread;

import static com.pwc.common.Util.Time.*;

import com.pwc.conversionTool.entity.Account;
import com.pwc.conversionTool.entity.TaskFlowLog;
import com.pwc.conversionTool.entity.TaskFlow;

public class SoapThread implements Runnable {

	private volatile boolean isRunning = false;

	private String threadName = "";
	
	private Account account;
	
	private TaskFlow taskFlow;
	
	private TaskFlowLog log;
	
	private TaskProcess tp;
	

	public SoapThread() {
		super();
	}

	public SoapThread(Account account, TaskFlow taskFlow) {
		super();
		this.threadName = taskFlow.getTaskFlowName();
		this.account = account;
		this.taskFlow = taskFlow;
		//this.log=new TaskFlowLog(threadName);
	}

	@Override
	public void run() {
		start();
		try {
			//
			System.out.println("thread is running ");
			
			tp.initial(taskFlow, account,log);
			
			
		} catch (Exception e) {
			e.printStackTrace();
		}finally{
			stop();
		}
	}
	
	protected void start()
	{
		isRunning = true;
	}

	public boolean isRunning() {
		return isRunning;
	}

	public void stop() {
		isRunning = false;
	}



	public Account getAccount() {
		return account;
	}

	public void setAccount(Account account) {
		this.account = account;
	}
	
	

	public String getThreadName() {
		return threadName;
	}

	public void setThreadName(String threadName) {
		this.threadName = threadName;
	}

	public TaskFlow getTaskFlow() {
		return taskFlow;
	}

	public void setTaskFlow(TaskFlow taskFlow) {
		this.taskFlow = taskFlow;
	}

	public TaskFlowLog getLog() {
		return log;
	}

	public void setLog(TaskFlowLog log) {
		this.log = log;
	}

}
